/**
 * 
 */
package gopi.labs.bluetoothdevice;

import gopi.labs.Connector.CCDConnector;
import gopi.labs.Connector.CloudCommunicationDevice;
import gopi.labs.Connector.Device;
import gopi.labs.Connector.NameValue;
import gopi.labs.exceptions.InValidIdentifier;
import gopi.labs.exceptions.InvalidAccessType;
import gopi.labs.exceptions.InvalidCommunicationType;
import gopi.labs.exceptions.InvalidConnectionMode;
import gopi.labs.exceptions.InvalidDataRecord;
import gopi.labs.exceptions.InvalidDeviceClass;

/**
 * @author GS4
 *
 */
public class ArduinoConnectorBluetooth extends CCDConnector {

	
	@Override
	public void generateCode() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void generateBinaryCode() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void flashCode() {
		// TODO Auto-generated method stub
		
	}
	
	public String toString() {
		return super.toString();
	}

	public void validate() throws InvalidCommunicationType, InvalidDeviceClass, InValidIdentifier, InvalidConnectionMode 
	{
		super.validate();
		
	}
	/**
	 * @param args
	 * @throws InvalidAccessType 
	 * @throws InvalidDeviceClass 
	 * @throws InvalidCommunicationType 
	 * @throws InValidIdentifier 
	 * @throws InvalidDataRecord 
	 * @throws InvalidConnectionMode 
	 */
	public static void main(String[] args) throws InvalidAccessType, InvalidCommunicationType, InvalidDeviceClass, InValidIdentifier, InvalidDataRecord, InvalidConnectionMode {
		ArduinoConnectorBluetooth arduino = new ArduinoConnectorBluetooth();

		arduino.setDeviceClass(CCDConnector.DeviceClasses.ARDUINO);
		arduino.setCommunicationType(CCDConnector.CommunicationTypes.BLUETOOTH);
		
		
		// Initialize CCD 
		CloudCommunicationDevice ccd = new CloudCommunicationDevice("ccd1");
		ccd.validate();
		
		//Initialize Devices 
		
		// Device 1 
		BlueToothDevice device = new BlueToothDevice("btd1");
		
		device.addDeviceAttribute(new NameValue("NAME", "Unit1"));
		device.addDeviceAttribute(new NameValue("ID" , "FireFly1"));
		device.addDeviceAttribute(new NameValue("PASSCODE" , "0001"));
		device.setAccessType(Device.AccessType.CONTINUOUS);
		device.setConnectionMode(BlueToothDevice.ConnectionMode.MASTER);
		device.validate();
		ccd.addDevice(device);
		
		// Device 2 
		device = new BlueToothDevice("btd2");
		
		device.addDeviceAttribute(new NameValue("NAME", "Unit2"));
		device.addDeviceAttribute(new NameValue("ID" , "FireFly2"));
		device.addDeviceAttribute(new NameValue("PASSCODE" , "0002"));
		device.setAccessType(Device.AccessType.CONTINUOUS);
		device.setConnectionMode(BlueToothDevice.ConnectionMode.MASTER);
		device.validate();
		ccd.addDevice(device);
		
		// Device 3
		device = new BlueToothDevice("btd3");
		
		device.addDeviceAttribute(new NameValue("NAME", "Unit3"));
		device.addDeviceAttribute(new NameValue("ID" , "FireFly3"));
		device.addDeviceAttribute(new NameValue("PASSCODE" , "0003"));
		device.setAccessType(Device.AccessType.CONTINUOUS);
		device.setConnectionMode(BlueToothDevice.ConnectionMode.SLAVE);
		device.validate();
		ccd.addDevice(device);
		arduino.setCcd(ccd);
		System.out.println(arduino);
		arduino.validate();
		arduino.generateCode();
		
	}
}
